package com.hz.score.ind.controller;


import com.hz.score.common.dto.PageDto;
import com.hz.score.ind.dto.IndInfoDto;
import com.hz.score.ind.service.IndService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "企业指标编辑类", description = "编辑企业指标数据")
@Controller
@RequestMapping("/ind")
public class IndController {

    @Resource
    IndService indService;

    @ApiOperation("分页查询企业指标数据")
    @PostMapping("/page")
    @ResponseBody
    private PageDto<IndInfoDto> pageBaseEnt(@RequestBody IndInfoDto indInfoDto,
                                            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                            @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
        return indService.pageIndEnt(indInfoDto, pageSize, pageNum);
    }

    @ApiOperation("新增企业指标数据")
    @PostMapping("/new")
    @ResponseBody
    private void newBaseEnt(@RequestBody IndInfoDto indInfoDto) {
        indService.newIndEnt(indInfoDto);
    }

    @ApiOperation("修改企业指标数据")
    @PostMapping("/update")
    @ResponseBody
    private void updateBaseEnt(@RequestBody IndInfoDto indInfoDto) {
        indService.updateIndEnt(indInfoDto);
    }

    @ApiOperation("删除企业指标数据")
    @PostMapping("/delete")
    @ResponseBody
    private void delBaseEnt(@RequestBody IndInfoDto indInfoDto) {
        indService.delIndEnt(indInfoDto);
    }

    @ApiOperation("获取企业指标数据")
    @PostMapping("/get")
    @ResponseBody
    private IndInfoDto getBaseEnt(@RequestParam(value = "id") Long id) {
        return indService.getIndEnt(id);
    }
}
